(deftemplate tramvai
	(slot ora )
	(slot stare(allowed-values Zero Initiala Deplasare Stationare Intoarcere Final ))
    (slot poz)
)

(assert (tramvai (ora 5:00)(stare Zero) (poz initiala)))
(printout t  crlf "    ---->STARILE TRAMVAIULUI DE PE LINIA 5 <----- " crlf  )
(printout t  crlf "ORA 5:00 -> RONAT || " crlf  )


(defrule rule1
	?id<-(tramvai (poz initiala))
	=>
	
	(retract ?id)
	(assert (tramvai (ora 5:20)(stare Initiala) (poz oprit)))
	(printout t crlf "ORA 5:20 -> BALTA VERDE || " crlf)
	
)

(defrule rule2
	?id<-(tramvai (poz oprit))
	=>
	
	(retract ?id)
	(assert (tramvai (ora 5:40)(stare Deplasare) (poz pornit)))
	(printout t crlf "ORA 5:40 ->MENDELEEV ==>" crlf)
	
)

(defrule rule3
	?id<-(tramvai (poz pornit))
	=>
	
	(retract ?id)
	(assert (tramvai (ora 6:00)(stare Stationare) (poz stationat)))
	(printout t crlf "ORA 6:00 ->CALEA CIRCUMVALATIUNII ||" crlf)
	
)

(defrule rule4
	?id<-(tramvai (poz stationat))
	=>
	
	(retract ?id)
	(assert (tramvai (ora 6:20)(stare Stationare) (poz stationat)))
	(printout t crlf "ORA 6:20 -> PIATA TIMISOARA 700 ||" crlf)
	
)

(defrule rule5
	?id<-(tramvai (poz stationat))
	=>
	
	(retract ?id)
	(assert (tramvai (ora 6:40)(stare Stationare) (poz stationat)))
	(printout t crlf "ORA 6:40 -> LIBERTATII ||" crlf)
	
)

(defrule rule6
	?id<-(tramvai (poz stationat))
	=>
	
	(retract ?id)
	(assert (tramvai (ora 7:00)(stare Stationare) (poz stationat)))
	(printout t crlf "ORA 7:00 -> HOTEL CONTINENTAL ||" crlf)
	
)


(defrule rule7
	?id<-(tramvai (poz stationat))
	=>
	
	(retract ?id)
	(assert (tramvai (ora 7:40)(stare Intoarcere) (poz intoarce)))
	(printout t crlf "ORA 7:40 ->PIATA TRAIAN  <==" crlf)
	
) 

(defrule rule8
	?id<-(tramvai (poz intoarce))
	=>
	
	(retract ?id)
	(assert (tramvai (ora 23:00)(stare Final) (poz finala)))
	(printout t crlf "ORA 23:00 -> RONAT __||__" crlf)
	
)

(agenda)
(run)
(facts)